<?php
require_once(dirname(__FILE__)."/../core/safeParam.php");

if ($_GET['id'] == ''){
  $query = $database->query("SELECT * FROM pages WHERE id = '1'");
  while ($list = mysql_fetch_array($query)) {
          
    $meta_keywords = $list['keywords'];
    $meta_description = $list['description'];
    $meta_title = $list['title'];
    $meta_manual = $list['manualmeta'];
    
    $id = $list['id'];
    $subid = $list['id'];
    $subparent = $list['parent'];
    $title = $list['title'];
    $linktitle = $list['linktitle'];
    $superid = $list['id'];
    $pagename = $list['pagename'];
    $pagenamebg = $list['id'];
    $description = $list['description'];
    $parent = $list['parent'];
    $subpagename = $list['pagename'];	

    if ($description == '') {
      $description = $sitename;
    }else {
      $description = $list['description'];
    }

    $content = $list['content'];
  }

}else {

  $id = $_GET['id'];
  $subid =$_GET['id'];

  $query = $database->query("SELECT * FROM pages WHERE id = $id");
  while ($list = mysql_fetch_array($query)) {
    $meta_keywords = $list['keywords'];
    $meta_description = $list['description'];
    $meta_title = $list['title'];
    $meta_manual = $list['manualmeta'];
    
    $id1 = $list['id'];
    $title = $list['title'];
    $linktitle = $list['linktitle'];
    $pagename1 = $list['pagename'];
    $description = $list['description'];
    $content = $list['content'];
    $parent1 = $list['parent'];
    $subcat1 = $list['subcat'];
    $superparent = $list['parent'];
    $superid = $list['id'];
    $superpagename = $list['pagename'];
    $subparent = $list['parent'];				
    $subpagename = $list['pagename'];			
  }
  
  $query6 = $database->query("SELECT *  FROM pages WHERE id = $id");
  while ($list6 = mysql_fetch_array($query6)) {
    $id6 = $list6['id'];
    $linktitle6 = $list6['linktitle'];
    $menuitem6 = $list6['menuitem'];
    $pagename6 = $list6['pagename'];
    //shorten and strip tags for dsecription
    $content6 = $list6['content'];
    $content6 = strip_tags($content6);
    $content6 = substr($content6,0,200);
    //if we dont have a link name use a page name instead
    if ($menuitem6 == '1') {
            $metatitle = $linktitle6;
    } else {
            $metatitle = $pagename6;
    }

  }

}
$smarty->assign('page_name',$linktitle);
$smarty->assign('page_content',$content);
$smarty->assign('homecontent',HOMECONTENT);

?>
